#include <cstdio>
#include <algorithm>
#include <cstring>
#include <queue>
#define _clr(x,a) memset(x,a,sizeof(x));
using namespace std;
const int N=215;
const int INF=0x3f3f3f3f;
int e=0;
int n,m,s;
double v;
double g1[N][N];
double g2[N][N];
double dis[N];
bool vis[N];
//记录到这个点走过多少个点了
int cnt[N];
bool spfa(){
    for(int i=1;i<=n;i++){
        dis[i]=0;
    }
    vis[s]=true;
    dis[s]=v;
    queue<int> q;
    q.push(s);
    while(!q.empty()){
        int cur=q.front();
        q.pop();
        vis[cur]=false;
        for(int i=1;i<=n;i++){
            if(i==cur || g1[cur][i]==INF){
                continue;
            }
            if((dis[cur]-g2[cur][i])*g1[cur][i]>dis[i]){
                dis[i]=(dis[cur]-g2[cur][i])*g1[cur][i];
                if(!vis[i]){
                    q.push(i);
                    vis[i]=true;
                }
                cnt[i]++;
                if(dis[s]>v || cnt[i]>=1000){
                    return true;
                }
            }
        }
    }
    return false;
}
int main(void){
    //freopen("data.txt","r",stdin);
    scanf("%d%d%d%lf",&n,&m,&s,&v);
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++){
            if(i==j){
                g1[i][j]=0;
                g2[i][j]=0;
            }
            else{
                g1[i][j]=INF;
                g2[i][j]=INF;
            }
        }
    }
    while(m--){
        int u,v;
        double c1,d1,c2,d2;
        scanf("%d%d%lf%lf%lf%lf",&u,&v,&c1,&d1,&c2,&d2);
        g1[u][v]=c1;
        g2[u][v]=d1;
        g1[v][u]=c2;
        g2[v][u]=d2;
    }
    if(spfa()){
        printf("YES\n");
    }
    else{
        printf("NO\n");
    }
    return 0;
}
